#encoding=utf8
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import silhouette_score
import numpy as np


def kmeans_cluster(data):
    '''
    input:data(ndarray):样本数据
    output:result(ndarray):聚类结果
    '''

    

    #********* Begin *********#
    kmeans = KMeans(n_clusters=3, random_state=888)
    
    # 拟合数据
    kmeans.fit(data)
    
    # 获取聚类结果
    #result = kmeans.labels_
    result = kmeans.fit_predict(data)
    #********* End *********# 
    return result


